home *** CD-ROM | disk | FTP | other *** search
- package com.anyEase.ScreenSaver;
-
- import javax.microedition.lcdui.Font;
- import javax.microedition.lcdui.Graphics;
-
- public class Block {
- // $FF: renamed from: nX int
- int field_0;
- // $FF: renamed from: nY int
- int field_1;
- int nX2;
- int nY2;
- int nWidth;
- int nHeight;
- int ScrWidth;
- int ScrHeight;
- byte nSpeed = 1;
- byte xDir = 1;
- byte yDir = 1;
- String strLabel;
- byte nType;
-
- public Block(String var1, int var2, int var3) {
- this.strLabel = var1;
- this.ScrWidth = var2;
- this.ScrHeight = var3;
- this.nType = 1;
- this.setSize();
- }
-
- public int getHeight() {
- return this.nHeight;
- }
-
- public String getLabel() {
- return this.strLabel;
- }
-
- public byte getType() {
- return this.nType;
- }
-
- public int getWidth() {
- return this.nWidth;
- }
-
- public int getX() {
- return this.field_0;
- }
-
- public int getY() {
- return this.field_1;
- }
-
- public void init(int var1, int var2, int var3, int var4) {
- this.field_0 = var1;
- this.field_1 = var2;
- this.xDir = (byte)(var3 >= 0 ? 1 : -1);
- this.yDir = (byte)(var4 >= 0 ? 1 : -1);
- }
-
- public void move() {
- this.nX2 = this.field_0;
- this.nY2 = this.field_1;
- int var1 = this.field_0 + this.xDir * this.nSpeed;
- if (var1 + this.nWidth <= this.ScrWidth && var1 >= 0) {
- this.field_0 = var1;
- } else {
- this.xDir *= -1;
- }
-
- var1 = this.field_1 + this.yDir * this.nSpeed;
- if (var1 + this.nHeight <= this.ScrHeight && var1 >= 0) {
- this.field_1 = var1;
- } else {
- this.yDir *= -1;
- }
-
- }
-
- public void paint(Graphics var1) {
- var1.setColor(0);
- var1.fillRect(this.nX2, this.nY2, this.nWidth, this.nHeight);
- var1.setColor(255, 255, 255);
- var1.drawString(this.strLabel, this.field_0, this.field_1, 20);
- }
-
- public void setLabel(String var1) {
- this.strLabel = var1;
- this.setSize();
- }
-
- public void setSize() {
- this.nWidth = Font.getDefaultFont().stringWidth(this.strLabel);
- this.nHeight = Font.getDefaultFont().getHeight();
- }
-
- public void setType(byte var1) {
- this.nType = var1;
- }
- }
-